//
//  CoreDataManager.h
//  iOSStudy
//
//  Created by Evan Xie on 12/1/15.
//  Copyright © 2015 Family Wings. All rights reserved.
//

#import <CoreData/CoreData.h>
#import <Foundation/Foundation.h>

#import "Phone.h"
#import "Person.h"


/** 
 It's a generic result block. If your operation will return data back, result will be your data.
 If your operation will not return data back, result will be a bool number to tell you operation 
 success or failure.
 */
typedef void (^CoreDataOperationResultBlock)(id result, NSError *error);


@interface CoreDataManager : NSObject

+ (instancetype)sharedManager;

- (BOOL)isMigrationNeeded;
- (BOOL)migrate:(NSError **)error;

- (void)insertTestData;

- (void)getAllPhonesWithResultBlock:(CoreDataOperationResultBlock)resultBlock;

@end
